/*******************************************************************************
Paper: Does the Production Approach to Markup Estimation Match a Stylized Fact?
Description: Imports population density data from Excel and saves a processed version
Author: Tove Forsbacka
Last Updated: 15 February 2026
*******************************************************************************/

* Setup and environment control 
clear
set more off
capture log close 

* Define path and load the data
*cd "PROJECT_PATH"
import excel "population_density.xlsx", sheet("BE0101U1") cellrange(A3:AE293) firstrow

drop B C D E F G H AE

rename A Kommunkod 
rename I y1998
rename J y1999
rename K y2000
rename L y2001
rename M y2002
rename N y2003
rename O y2004
rename P y2005
rename Q y2006
rename R y2007
rename S y2008
rename T y2009
rename U y2010
rename V y2011
rename W y2012
rename X y2013
rename Y y2014
rename Z y2015
rename AA y2016
rename AB y2017
rename AC y2018
rename AD y2019

destring Kommunkod, gen(nKommunkod)
drop Kommunkod
rename nKommunkod Kommunkod

reshape long y, i(Kommunkod) j(year)

rename y population_density

* Saving the data
save "population_density.dta", replace